/* eslint valid-jsdoc: "off" */

'use strict';

const auth = require("../app/middleware/auth");

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /***-
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  config.security = {
    csrf: {
      enable: false,
    }
  };

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1616382878490_883';

  // add your middleware config here
  config.middleware = ['cors','auth'];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  // 连接mongoose数据库
  config.mongoose = {
    url: 'mongodb://127.0.0.1/movies'
  };
  // 配置arttemplate
  config.view = {
    mapping: {
      '.html': 'arttemplate',
    },
  };
  // arttemplate config
  config.arttemplate = {
    escape: true,
    debug: false,
    bail: true,
    cache: true
  };


  // 设置秘钥egg-jwt
  config.jwt = {
    secret:'123456'
  }

  return {
    ...config,
    ...userConfig,
  };
};
